package com.dragon.pear.common.utils;

import android.view.View;

import com.chris.libs.http.x.v1.CompleteCallback;
import com.chris.libs.http.x.v1.DefaultCallback;
import com.chris.libs.http.x.v1.NetResult;
import com.dragon.pear.base.SuccessStatusNetCallback;

import retrofit2.Call;

/**
 * @author Chris chan
 * Create on： 2025/2/5 4:16
 * Use for:
 * Explain:
 */
public class DefaultHttp {
    /**
     * 统一定义的post请求
     *
     * @param call
     * @param callback
     * @param <T>
     */
    public static <T> void post(Call<NetResult<T>> call, CompleteCallback<T> callback) {
        call.enqueue(new DefaultCallback<T>(callback));
    }

    /**
     * 待状态处理的post请求
     *
     * @param call
     * @param ownView
     * @param callback
     * @param <T>
     */
    public static <T> void post(Call<NetResult<T>> call, View ownView, CompleteCallback<T> callback) {
        call.enqueue(new SuccessStatusNetCallback<>(callback).with(ownView));
    }
}
